<template>
  <!--img src="./assets/logo.png" style="float:left;width:120px;height:120px" -->
  <div>
  <div id="nav" class="header" align="center">
    <button class="btn" id="login"  @click="login(keyword)">登录/注册</button>
    <div class="container" style="align: center; height: 200px; width: 1300px">
      <h1 style="margin-top: 20px; margin-bottom: 0px; font-size: 80px">
        发奋识遍天下字，立志读尽人间书
      </h1>     
      <div class="wrap visible-lg-block visible-md-block">
        <div
          name="form_p"
          class="navbar-form navbar-right hidden-sm"
          id="form_p"
          role="search"
        >
          <div class="input-group">
            <input
              name="keyword"
              class="form-control"
              id="keyword"
              type="text"
              placeholder="请输入学校名称"
              v-model="keyword"
            />
            <span class="input-group-btn">
              <button class="btn" id="button_p"  @click="search(keyword)">搜索</button>
            </span>
          </div>
        </div>
      </div>
    </div>
  </div>
  <div id="bline" />
  <div class="main">
    <router-view />
  </div>
  <Footer />
  
  </div>
</template>
<script lang="ts">
import axios from "axios"
import Footer from "@/components/Footer.vue";

import { defineComponent,ref, reactive ,watchEffect,watch} from "vue";
import { useRouter } from 'vue-router';

export default defineComponent({
  components: {
    Footer,
  },
setup: (props, context) => {
  const router = useRouter();
  var keyword = "";
  

  const search = (keyword) => {
    var url ="api/plat/org-description";
    console.log(url);
    // axios.post(url,  {})
		// 	.then(res => {
		// 		// obj.success ? obj.success(res) : null
    //     console.log(res)
		// 	  console.log("success")
    //     var routerData = {
    //       name: 'orgSearch',
    //       params: { resultData:JSON.stringify(res.data.resultData) },
    //       query: {
    //         url:url,
    //         data:keyword,
    //         time:Date.now()
    //       }
    //     }
    //     router.push(routerData);
		// 	})
		// 	.catch(error => {
		// 		// obj.error ? obj.error(error) : null;
		// 		console.log("error")
		// 	})
    // }
        var routerData = {
          name: 'orgSearch',
          params: { resultData:[]},
          query: {
            url:url,
            data:keyword,
            time:Date.now()
          }
        }
        router.push(routerData);
    }
    const login = ()=>{
        var routerData = {
          name: 'Login'
        }
        router.push(routerData);
    };
    var defaultData = {
      search:search,
      login,
      keyword
    };
    return defaultData;
},
})
</script>
<style lang="less" scoped>
.home_nav {
  background: -moz-linear-gradient(left, #1da31d 80%, #3a8cf7 100%);
  background: -webkit-gradient(
    linear,
    left top,
    left bottom,
    color-stop(80%, #1da31d),
    color-stop(100%, #3a8cf7)
  );
  background: -webkit-linear-gradient(left, #1da31d 80%, #3a8cf7 100%);
  background: -o-linear-gradient(left, #1da31d 80%, #3a8cf7 100%);
  background: -ms-linear-gradient(left, #1da31d 80%, #3a8cf7 100%);
  background: linear-gradient(to right, #1da31d 80%, #3a8cf7 100%);
}

.container {
  padding-right: 15px;
  padding-left: 15px;
  margin-right: auto;
  margin-left: auto;
  margin-top: auto;
  margin-bottom: auto;
}

#login{
  float: right;
  background-color: inherit;
  margin: 15px;
  border-radius: 20px;
  border: 0.2em;
  font-size: 16px;
  color:beige;
  font-weight: bold;
}
#login:hover{
  cursor: pointer;
}

.form-control {
  width: 40%;
  max-width: 600px;
  height: 40px;
  border: 2px solid #3a8cf7;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
  padding-left: 10px;
}

.btn {
  width: 120px;
  height: 40px;
}
.btn:hover{
  cursor: pointer;
}
#button_p {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px;
  color: #fff;
  background: #3a8cf7;
  border: 2px solid #3a8cf7;
}

#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  background: #fff;
}

#nav {
  height: 200px;
  overflow: hidden;
  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}

#bline {
  padding: 3px;
  background: #3a8cf7;
}

.header {
  width: 100%;
  position: absolute;
  top: 0; 
  height: 200px;
  overflow: hidden;
  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
  background: -moz-linear-gradient(left, #1da31d 80%, #3a8cf7 100%);
  background: -webkit-gradient(
    linear,
    left top,
    left bottom,
    color-stop(80%, #1da31d),
    color-stop(100%, #3a8cf7)
  );
  background: -webkit-linear-gradient(left, #1da31d 80%, #3a8cf7 100%);
  background: -o-linear-gradient(left, #1da31d 80%, #3a8cf7 100%);
  background: -ms-linear-gradient(left, #1da31d 80%, #3a8cf7 100%);
  background: linear-gradient(to right, #1da31d 80%, #3a8cf7 100%);
}
.main {
  width: 100%;
  position: absolute;
  top: 200px;
  bottom: 30px;
  height: auto; 
  flex: 1;
  overflow: auto;
}
</style>
